package com.party.core.service.school.impl;

import com.google.common.base.Strings;
import com.party.common.paging.Page;
import com.party.core.dao.read.school.ScClassTSReadDao;
import com.party.core.dao.write.school.ScClassTSWriteDao;
import com.party.core.model.BaseModel;
import com.party.core.model.school.ScClassTS;
import com.party.core.service.school.IScClassTSService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;
import java.util.Set;

@Service
public class ScClassTSService implements IScClassTSService {
    @Autowired
    private ScClassTSReadDao scClassTSReadDao;
    @Autowired
    private ScClassTSWriteDao scClassTSWriteDao;

    @Override
    public String insert(ScClassTS scClassTS) {
        BaseModel.preInsert(scClassTS);
        if (scClassTSWriteDao.insert(scClassTS)) {
            return scClassTS.getId();
        }
        return null;
    }

    @Override
    public boolean update(ScClassTS scClassTS) {
        scClassTS.setUpdateDate(new Date());
        return scClassTSWriteDao.update(scClassTS);
    }

    @Override
    public boolean deleteLogic(String id) {
        return false;
    }

    @Override
    public boolean delete(String id) {
        if (Strings.isNullOrEmpty(id)) {
            return false;
        }
        return scClassTSWriteDao.delete(id);
    }

    @Override
    public boolean batchDeleteLogic(Set<String> ids) {
        return false;
    }

    @Override
    public boolean batchDelete(Set<String> ids) {
        return false;
    }

    @Override
    public ScClassTS get(String id) {
        if (Strings.isNullOrEmpty(id)) {
            return null;
        }
        return scClassTSReadDao.get(id);
    }

    @Override
    public List<ScClassTS> listPage(ScClassTS scClassTS, Page page) {
        return scClassTSReadDao.listPage(scClassTS, page);
    }

    @Override
    public List<ScClassTS> list(ScClassTS scClassTS) {
        return scClassTSReadDao.listPage(scClassTS, null);
    }

    @Override
    public List<ScClassTS> batchList(Set<String> ids, ScClassTS scClassTS, Page page) {
        return null;
    }
}
